package training;
import java.util.Scanner;
/**
 * @Author liangzai
 * @Description:
 */
public class J25_8_7_Training {
    //谁作弊了
    public class Main {
        // 检查字符是否是字母或数字
        public static boolean checkIs(char ch) {
            return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9');
        }

        // 检查字符是否是大写字母
        public static boolean checkUpper(char ch) {
            return ch >= 'A' && ch <= 'Z';
        }

        // 检查字符是否是小写字母
        public static boolean checkLower(char ch) {
            return ch >= 'a' && ch <= 'z';
        }

        // 检查字符是否是数字
        public static boolean checkDigit(char ch) {
            return ch >= '0' && ch <= '9';
        }

        // 计算分数
        public static int getCnt(boolean f1, boolean f2, boolean f3) {
            if (f1 && f2 && f3) {
                return 5;
            } else if ((f1 && f3) || (f2 && f3)) {
                return 3;
            } else if (f1 && f2) {
                return 1;
            }
            return 0;
        }

        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            int len = 0, num = 0, ans = 0;

            while (scanner.hasNext()) {
                String s = scanner.next();
                boolean f1 = false, f2 = false, f3 = false;
                StringBuilder cword = new StringBuilder(); // 用于记录关键字，替代C++的string

                for (int i = 0; i < s.length(); i++) {
                    char ch = s.charAt(i);
                    if (checkIs(ch)) {
                        cword.append(ch);
                        if (checkUpper(ch)) {
                            f1 = true;
                        }
                        if (checkLower(ch)) {
                            f2 = true;
                        }
                        if (checkDigit(ch)) {
                            f3 = true;
                        }
                    } else { // 遇到分隔符，结算当前单词
                        if (cword.length() > 0) {
                            ans += getCnt(f1, f2, f3);
                            len += cword.length();
                            cword.setLength(0); // 清空StringBuilder
                            if (f1 || f2 || f3) {
                                num++;
                            }
                            f1 = false;
                            f2 = false;
                            f3 = false;
                        }
                    }
                }

                // 处理字符串末尾的单词
                if (cword.length() > 0) {
                    ans += getCnt(f1, f2, f3);
                    if (f1 || f2 || f3) {
                        num++;
                    }
                    len += cword.length();
                    cword.setLength(0);
                }
            }

            System.out.println(ans);
            System.out.println(len + " " + num);
            scanner.close();
        }
    }

}
